package com.wzy.level.detail.detailServiceImpl;

import com.wzy.Jdbc封装.pojo.News_detail;
import com.wzy.level.byPage.byPageDto.ByPage;
import com.wzy.level.detail.detailDao.detailDao;
import com.wzy.level.detail.detailDaoImpl.detailDaoImpl;
import com.wzy.level.detail.detailService.detailService;

import java.util.ArrayList;
import java.util.List;

public class detailServiceImpl implements detailService {
    private detailDao detailDao = new detailDaoImpl();

    @Override
    public List<News_detail> selectAll() {
        List<News_detail> news_details = detailDao.selectAll();
        if (news_details.size()>0){
            return news_details;
        }else {
            return new ArrayList<News_detail>();
        }
    }

    @Override
    public News_detail selectById(int id) {
        return detailDao.selectById(id);
    }

    @Override
    public List<News_detail> selectByPage(ByPage byPage) {
        return detailDao.selectByPage(byPage);
    }

    @Override
    public int insert(News_detail detail) {
        return detailDao.insert(detail);
    }

    @Override
    public int update(News_detail detail) {
        return detailDao.update(detail);
    }

    @Override
    public int deleteById(News_detail detail) {
        return detailDao.deleteById(detail);
    }

    @Override
    public int deleteByName(News_detail detail) {
        return 0;
    }
}
